# -*- coding:utf-8 -*-
import json
import re

class PageInfo():
    page: int  = 0
    limit: int = 10

    def __init__(self, page:int, limit:int):
        self.page = page
        self.limit = limit


class QueryWrapper():
    def __init__(self, qw):
        self.queryWrapper = qw
    
    @staticmethod
    def build_query_wrapper(filter:str) -> dict:
        f = json.loads(filter)
        qw = {}

        for k in f:
            if re.match(r'^[a-z0-9_]+$', k)==None: 
                return None
            if f[k]!='':
                qw[k] = f[k]

        return qw